package ZooManagement;

/**
 * Item
 * @author ashongtical
 */
public class Item {

    public String name;      // （ex:“Fuel”、“Truck”）
    public String code;
    public double price;

    /**
     * Constructor for the Item class.
     * Initializes the item with a name and code. The price is set to 0.0 by default.
     *
     * @param name The name of the item
     * @param code The unique code for the item
     */
    public Item(String name, String code) {
        this.name = name;
        this.code = code;
        this.price = 0.0;
    }

    /**
     * Gets the name of the item.
     *
     * @return The name of the item
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the name of the item.
     *
     * @param name The name to be set for the item
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Gets the unique code of the item.
     *
     * @return The unique code of the item
     */
    public String getCode() {
        return code;
    }

    /**
     * Sets the unique code of the item.
     *
     * @param code The unique code to be set for the item
     */
    public void setCode(String code) {
        this.code = code;
    }

    /**
     * Gets the price of the item.
     *
     * @return The price of the item
     */
    public double getPrice() {
        return price;
    }

    /**
     * Sets the price of the item.
     *
     * @param price The price to be set for the item
     */
    public void setPrice(double price) {
        this.price = price;
    }

    /**
     * Displays the details of the item.
     * Prints the name, code, and price of the item to the console.
     */
    public void display() {
        System.out.println("Name: " + name + ", Code: " + code + ", Price: RMB " + price);
    }
}